package com.todo.event.activity.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/1/7 13:28
 * @description
 */
@AllArgsConstructor
@Getter
public enum EventClassifyEnum {
    MQ(1, "MQ", "消息事件"),
    INTERFACE(2, "INTERFACE", "接口"),
    BIN_LOG(3, "BIN_LOG", "数据库BINLOG"),
    ;

    private static Map<Integer, EventClassifyEnum> typeMap = Arrays
            .stream(EventClassifyEnum.values())
            .collect(Collectors.toMap(EventClassifyEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static EventClassifyEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
